#include<bits/stdc++.h>
using namespace std;
#define lsb(x) (x&-x)

int inline msb(int x) {
    if(x==0)return 0;
    int i;
    for(i=1<<20;!(x&i); i>>=1) {
        ;
    }
    return i;
}
int main() {
    cout<<msb(3)<<endl;
    cout<<msb(6)<<endl;
    cout<<msb(1024)<<endl;
    cout<<msb(0)<<endl;
}
